package com.medicine.mapper;

import com.medicine.entity.Specification;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SpecificationMapper {
    /**
     * 批量插入规格数据
     * @param specifications
     */
    void insertBatch(List<Specification> specifications);

    /**
     * 根据药品id删除对应的规格数据
     * @param medicineId
     */
    @Delete("delete from specification where medicine_id = #{medicineId}")
    void deleteByMedicineId(Long medicineId);

    /**
     * 根据药品id查询对应的规格数据
     * @param medicineId
     * @return
     */
    @Select("select * from specification where medicine_id = #{medicineId}")
    List<Specification> getByMedicineId(Long medicineId);

}

